

/**
 * removes all the empty characters form the begining and the end of the sring str
 * @param {string} str - string to process
 */
function ListonicTrim(str) {
	var trimmed = str

	if(trimmed) {
		trimmed = trimmed.replace(/^\s+|\s+$/g, '');
	}

	return trimmed;
}

/**
 * estimatest number of words in the string
 * @param {string} str
 */
function ListonicWC(str) {
	var wcregex = /(^|\s)[^\s]+?(?=\s|$)/ig;

	var matches = str.match(wcregex);

	if(matches) {
		return matches.length;
	} else {
		return 0;
	}
}

